package com.ruoyi.common.utils.bot;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.ruoyi.common.utils.http.HttpUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.web.client.RestTemplate;

/**
 * TODO
 *
 * @author chenchuan2
 * @date 2024-04-05 18:42:47
 */
@Component
public class FeishuBot {

    @Autowired
    private RestTemplate restTemplate;

    public void sendFeishuMsg(String message){
        JSONObject msg = new JSONObject();
        msg.put("msg_type","text");
        JSONObject content = new JSONObject();
        content.put("text",message);
        msg.put("content",content);

        restTemplate.postForEntity("https://open.feishu.cn/open-apis/bot/v2/hook/cf256719-c280-45dc-a4f0-7363ccbe6fe2",msg.toJSONString(),String.class);
//        HttpUtils.sendPost(,msg.toJSONString());
    }
}
